#!/bin/bash
# sets the root password on EC2 instances
sed -i "s#^root:[^:]*#root:@@@CRYPTEDPASSWORD@@@#" /etc/shadow
sed -i "s#^root:[^:]*#root:@@@CRYPTEDPASSWORD@@@#" /etc/shadow-
# adjust sshd to allow login with password
sed -i "s#^PasswordAuthentication.*#PasswordAuthentication yes#g" /etc/ssh/sshd_config
if [ -x /etc/init.d/ssh ]; then
	/etc/init.d/ssh restart
elif [ -x /etc/init.d/ssh ]; then
	/etc/init.d/sshd restart
fi
